package com.jzr.bedside.ui.adapter

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.jzr.bedside.R
import com.jzr.bedside.base.Constant
import com.jzr.bedside.bean.SkillListBean
import com.jzr.bedside.utils.GlideUtils


class SkillMainAdapter(data: MutableList<SkillListBean>?) :
    BaseQuickAdapter<SkillListBean, BaseViewHolder>(
        R.layout.item_skill_list,
        data
    ) {


    override fun convert(helper: BaseViewHolder?, item: SkillListBean?) {

        val ivSkill = helper?.getView<ImageView>(R.id.ivSkill)
        val drawbaleId = item?.drawableId
        if (item?.id != null) {
            if (ivSkill != null) {
                Glide.with(mContext).load(drawbaleId).into(ivSkill)
            };
        }
        helper?.itemView?.setOnClickListener {
            onItemClick?.onListItemClick(item)
        }
    }


    private var onItemClick: onListItemClick? = null

    interface onListItemClick {
        fun onListItemClick(item: SkillListBean?)
    }

    fun onListItemClick(onListItemClick: onListItemClick?) {
        this.onItemClick = onListItemClick
    }


}
